package my.edu.model.commodity.service;

import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService;
import my.edu.common.domain.OrderProductDetail;
import my.edu.common.domain.PageDTO;
import my.edu.common.domain.PageVO;
import my.edu.common.domain.purchase.PriceAndQuantity;
import my.edu.model.commodity.entity.Product;
import my.edu.model.commodity.entity.dto.ProductDTO;
import my.edu.model.commodity.entity.dto.ProductSearchDTO;
import my.edu.model.commodity.entity.vo.ProductVO;

import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutionException;

public interface IProductService extends IService<Product> {
    void savenew(ProductDTO productDTO);

    PageVO<ProductVO> listAll(PageDTO pageDTO, ProductSearchDTO productSearchDTO);

    ProductVO getVOById(Long id);

    void updateByDTO(ProductDTO productDTO);

    void addCurrentStock(List<OrderProductDetail>  orderProductDetailList);

    void subCurrentStock(List<OrderProductDetail>  orderProductDetailList);

    void addCurrentStock(Map<Long, Integer> collect);

    void subCurrentStock(Map<Long, Integer> collect);

    //主要进行存在性和可用性校验，以及查看商品有无高价进货或者低价出售
    PriceAndQuantity chackAndGetTotal(List< ? extends OrderProductDetail> purchaseDetailDTOList, String status);

    void addCurrentStockAndSetLastPurchasePrice(List<OrderProductDetail> orderProductDetails);

    void setStatus(List<Long> longs, int status);

    List<ProductVO> getVOByNos(List<String> productNos);

    List<ProductVO> getVOByParam(String q);


    void checkProduct(Long productId);

    JSONObject getListWithStock(PageDTO pageDTO, String materialParam, Integer categoryId) throws ExecutionException, InterruptedException;

    JSONObject findStockWarningCount(PageDTO pageDTO);
}
